WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
rotations.h
Go to the documentation of this file.
1// WOLF - Copyright (C) 2020-2026
2// Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
3// Authors: Joan Solà Ortega (jsola@iri.upc.edu) and
4// Joan Vallvé Navarro (jvallve@iri.upc.edu)
5// All rights reserved.
6//
7// This file is part of WOLF: http://www.iri.upc.edu/wolf
8// WOLF is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License version 3
10// as published by the Free Software Foundation.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19#pragma once
20
21#include "core/common/wolf.h"
22
23namespace wolf
24{
26
32template <typename T>
33inline T pi2pi(const T& _angle)
34{
35 return remainder(_angle, 2 * M_PI);
36}
37
43template <typename T>
44inline T toRad(const T deg)
45{
46 return (T)M_TORAD * deg;
47}
48
54template <typename T>
55inline T toDeg(const T rad)
56{
57 return (T)M_TODEG * rad;
58}
59
61// Operators skew and vee
62
68template <typename Derived>
69inline Eigen::Matrix<typename Derived::Scalar, 3, 3> skew(const Eigen::MatrixBase<Derived>& _v)
70{
72
73 typedef typename Derived::Scalar T;
74
75 Eigen::Matrix<T, 3, 3> sk;
76
77 sk << (T)0.0, -_v(2), +_v(1), +_v(2), (T)0.0, -_v(0), -_v(1), +_v(0), (T)0.0;
78
79 return sk;
80}
81
87template <typename Derived>
88inline Eigen::Matrix<typename Derived::Scalar, 3, 1> vee(const Eigen::MatrixBase<Derived>& _m)
89{
91
92 typedef typename Derived::Scalar T;
93
94 return (Eigen::Matrix<T, 3, 1>() << _m(2, 1), _m(0, 2), _m(1, 0)).finished();
95}
96
98// Rotation conversions q, R, Euler, back and forth
99//
100// Euler angles are denoted 'e' and are in the ZYX convention
101
107template <typename Derived>
108inline Eigen::Matrix<typename Derived::Scalar, 3, 3> q2R(const Eigen::QuaternionBase<Derived>& _q)
109{
110 return _q.matrix();
111}
112
118template <typename Derived>
119inline Eigen::Matrix<typename Derived::Scalar, 3, 3> q2R(const Eigen::MatrixBase<Derived>& _q)
120{
122 Eigen::Quaternion<typename Derived::Scalar> q(_q(3), _q(0), _q(1), _q(2));
123 return q2R(q);
124}
125
131template <typename Derived>
132inline Eigen::Quaternion<typename Derived::Scalar> R2q(const Eigen::MatrixBase<Derived>& _R)
133{
135
136 return Eigen::Quaternion<typename Derived::Scalar>(_R);
137}
138
143template <typename D>
144inline Eigen::Quaternion<typename D::Scalar> e2q(const Eigen::MatrixBase<D>& _euler)
145{
147
148 typedef typename D::Scalar T;
149
150 const Eigen::AngleAxis<T> ax = Eigen::AngleAxis<T>(_euler(0), Eigen::Matrix<T, 3, 1>::UnitX());
151 const Eigen::AngleAxis<T> ay = Eigen::AngleAxis<T>(_euler(1), Eigen::Matrix<T, 3, 1>::UnitY());
152 const Eigen::AngleAxis<T> az = Eigen::AngleAxis<T>(_euler(2), Eigen::Matrix<T, 3, 1>::UnitZ());
153
154 return Eigen::Quaternion<T>(az * ay * ax);
155}
156
161template <typename Derived>
162inline Eigen::Matrix<typename Derived::Scalar, 3, 3> e2R(const Eigen::MatrixBase<Derived>& _e)
163{
165
166 return e2q(_e).matrix();
167}
168
171template <typename Derived>
172inline typename Eigen::Matrix<typename Derived::Scalar, 3, 1> R2e(const Eigen::MatrixBase<Derived>& _R)
173{
174 Eigen::Matrix<typename Derived::Scalar, 3, 1> e;
175
176 e(0) = atan2(_R(2, 1), _R(2, 2));
177 e(1) = atan2(-_R(2, 0), sqrt(_R(0, 0) * _R(0, 0) + _R(1, 0) * _R(1, 0)));
178 e(2) = atan2(_R(1, 0), _R(0, 0));
179
180 return e;
181}
182
185template <typename Derived>
186inline typename Eigen::Matrix<typename Derived::Scalar, 3, 1> q2e(const Eigen::MatrixBase<Derived>& _q)
187{
188 typedef typename Derived::Scalar T;
189 Eigen::Matrix<T, 3, 1> e;
190
191 const double& w = _q(3);
192 const double& x = _q(0);
193 const double& y = _q(1);
194 const double& z = _q(2);
195
196 double xx = x * x;
197 double xy = x * y;
198 double xz = x * z;
199 double yy = y * y;
200 double yz = y * z;
201 double zz = z * z;
202 double wx = w * x;
203 double wy = w * y;
204 double wz = w * z;
205
206 double r00 = T(1) - T(2) * (yy + zz);
207 double r10 = T(2) * (xy + wz);
208 double r20 = T(2) * (xz - wy);
209 double r21 = T(2) * (yz + wx);
210 double r22 = T(1) - T(2) * (xx + yy);
211
212 e(0) = atan2(r21, r22);
213 e(1) = atan2(-r20, sqrt(r00 * r00 + r10 * r10));
214 e(2) = atan2(r10, r00);
215
216 return e;
217}
218
221template <typename Derived>
222inline typename Eigen::Matrix<typename Derived::Scalar, 3, 1> q2e(const Eigen::QuaternionBase<Derived>& _q)
223{
224 return q2e(_q.coeffs());
225}
226
229template <typename Derived>
230inline typename Eigen::MatrixBase<Derived>::Scalar getYaw(const Eigen::MatrixBase<Derived>& _M)
231{
232 // Rotation matrix case
233 if (_M.rows() == 3 and _M.cols() == 3) return std::atan2(_M(1, 0), _M(0, 0));
234
235 // quaternion case
236 if (_M.rows() == 4 and _M.cols() == 1)
237 {
238 typedef typename Derived::Scalar T;
239 const double& w = _M(3, 0);
240 const double& x = _M(0, 0);
241 const double& y = _M(1, 0);
242 const double& z = _M(2, 0);
243 return atan2(T(2) * (x * y + w * z), T(1) - T(2) * (y * y + z * z));
244 }
245 // wrong input size
246 else
247 assert(false && "getYaw wrong input size. Should be 3x3 matrix (rotation matrix) or 4d vector (quaternion).");
248}
249
252template <typename Derived>
253inline typename Eigen::QuaternionBase<Derived>::Scalar getYaw(const Eigen::QuaternionBase<Derived>& _q)
254{
255 return getYaw(_q.coeffs());
256}
257
259// Rotation conversions - exp and log maps
260
266template <typename Derived>
267inline Eigen::Quaternion<typename Derived::Scalar> exp_q(const Eigen::MatrixBase<Derived>& _v)
268{
269 using std::cos;
270 using std::sin;
271 using std::sqrt;
272
274
275 typedef typename Derived::Scalar T;
276
277 T angle_squared = _v.squaredNorm();
278 T angle = sqrt(angle_squared); // Allow autodiff::Jet to use its own sqrt() version.
279
280 if (angle > (T)(wolf::Constants::EPS_SMALL))
281 {
282 return Eigen::Quaternion<T>(Eigen::AngleAxis<T>(angle, _v.normalized()));
283 }
284 else
285 {
286 return Eigen::Quaternion<T>((T)1.0, _v(0, 0) / (T)2, _v(1, 0) / (T)2, _v(2, 0) / (T)2);
287 }
288}
289
295template <typename Derived>
296inline Eigen::Matrix<typename Derived::Scalar, 3, 1> log_q(const Eigen::QuaternionBase<Derived>& _q)
297{
298 // Will try this implementation once Eigen accepts it!
299 // see https://forum.kde.org/viewtopic.php?f=74&t=143269&p=385299#p385265
300 // typedef typename Derived::Scalar T;
301 // Eigen::AngleAxis<T> aa(_q);
302 // return aa.angle() * aa.axis();
303
304 // In the meanwhile, we have a custom implementation as follows
305
306 typedef typename Derived::Scalar T;
307
308 Eigen::Matrix<T, 3, 1> vec = _q.vec();
309 const T sin_angle_squared = vec.squaredNorm();
310 if (sin_angle_squared > (T)wolf::Constants::EPS_SMALL)
311 {
312 const T sin_angle = sqrt(sin_angle_squared); // Allow autodiff::Jet to use its own sqrt() version.
313 const T& cos_angle = _q.w();
314
315 /* If (cos_angle < 0) then angle >= pi/2 , means : angle for angle_axis vector >= pi (== 2*angle)
316 |-> results in correct rotation but not a normalized angle_axis vector
317
318 In that case we observe that 2 * angle ~ 2 * angle - 2 * pi,
319 which is equivalent saying
320
321 angle - pi = atan(sin(angle - pi), cos(angle - pi))
322 = atan(-sin(angle), -cos(angle))
323 */
324 const T two_angle =
325 T(2.0) * ((cos_angle < T(0.0)) ? atan2(-sin_angle, -cos_angle) : atan2(sin_angle, cos_angle));
326 const T k = two_angle / sin_angle;
327 return vec * k;
328 }
329 else
330 {
331 // small-angle approximation
332 return vec * (T)2.0;
333 }
334}
335
341template <typename Derived>
342inline Eigen::Matrix<typename Derived::Scalar, 3, 3> exp_R(const Eigen::MatrixBase<Derived>& _v)
343{
344 using std::sqrt;
345
347
348 typedef typename Derived::Scalar T;
349
350 T angle_squared = _v.squaredNorm();
351 T angle = sqrt(angle_squared); // Allow autodiff::Jet to use its own sqrt() version.
352
353 if (angle > wolf::Constants::EPS_SMALL)
354 return Eigen::AngleAxis<T>(angle, _v.normalized()).toRotationMatrix();
355 else
356 return Eigen::Matrix<T, 3, 3>::Identity() + skew(_v);
357}
358
364template <typename Derived>
365inline Eigen::Matrix<typename Derived::Scalar, 3, 1> log_R(const Eigen::MatrixBase<Derived>& _R)
366{
367 return log_q(R2q(_R));
368}
369
375template <typename Derived>
376inline Eigen::Quaternion<typename Derived::Scalar> v2q(const Eigen::MatrixBase<Derived>& _v)
377{
378 return exp_q(_v);
379}
380
386template <typename Derived>
387inline Eigen::Matrix<typename Derived::Scalar, 3, 1> q2v(const Eigen::QuaternionBase<Derived>& _q)
388{
389 return log_q(_q);
390}
391
397template <typename Derived>
398inline Eigen::Matrix<typename Derived::Scalar, 3, 3> v2R(const Eigen::MatrixBase<Derived>& _v)
399{
400 return exp_R(_v);
401}
402
408template <typename Derived>
409inline Eigen::Matrix<typename Derived::Scalar, 3, 1> R2v(const Eigen::MatrixBase<Derived>& _R)
410{
411 return log_R(_R);
412}
413
415// Jacobians of SO(3)
416
431template <typename Derived>
432inline Eigen::Matrix<typename Derived::Scalar, 3, 3> jac_SO3_right(const Eigen::MatrixBase<Derived>& _theta)
433{
434 using std::cos;
435 using std::sin;
436 using std::sqrt;
437
439
440 typedef typename Derived::Scalar T;
441
442 T theta2 = _theta.squaredNorm();
443 Eigen::Matrix<T, 3, 3> W(skew(_theta));
444 if (theta2 <= Constants::EPS_SMALL)
445 return Eigen::Matrix<T, 3, 3>::Identity() - (T)0.5 * W; // Small angle approximation
446 T theta = sqrt(theta2); // rotation angle
447 Eigen::Matrix<T, 3, 3> M1, M2;
448 M1.noalias() = ((T)1 - cos(theta)) / theta2 * W;
449 M2.noalias() = (theta - sin(theta)) / (theta2 * theta) * (W * W);
450 return Eigen::Matrix<T, 3, 3>::Identity() - M1 + M2;
451}
452
471template <typename Derived>
472inline Eigen::Matrix<typename Derived::Scalar, 3, 3> jac_SO3_right_inv(const Eigen::MatrixBase<Derived>& _theta)
473{
474 using std::cos;
475 using std::sin;
476 using std::sqrt;
477
479
480 typedef typename Derived::Scalar T;
481
482 T theta2 = _theta.squaredNorm();
483 Eigen::Matrix<T, 3, 3> W(skew(_theta));
484 if (theta2 <= Constants::EPS_SMALL)
485 return Eigen::Matrix<T, 3, 3>::Identity() + (T)0.5 * W; // Small angle approximation
486 T theta = sqrt(theta2); // rotation angle
487 Eigen::Matrix<T, 3, 3> M;
488 M.noalias() = ((T)1.0 / theta2 - ((T)1.0 + cos(theta)) / ((T)2.0 * theta * sin(theta))) * (W * W);
489 return Eigen::Matrix<T, 3, 3>::Identity() + (T)0.5 * W + M; // is this really more optimized?
490}
491
505template <typename Derived>
506inline Eigen::Matrix<typename Derived::Scalar, 3, 3> jac_SO3_left(const Eigen::MatrixBase<Derived>& _theta)
507{
508 using std::cos;
509 using std::sin;
510 using std::sqrt;
511
513
514 typedef typename Derived::Scalar T;
515
516 T theta2 = _theta.squaredNorm();
517 Eigen::Matrix<T, 3, 3> W(skew(_theta));
518 if (theta2 <= Constants::EPS_SMALL)
519 return Eigen::Matrix<T, 3, 3>::Identity() - (T)0.5 * W; // Small angle approximation
520 T theta = sqrt(theta2); // rotation angle
521 Eigen::Matrix<T, 3, 3> M1, M2;
522 M1.noalias() = ((T)1 - cos(theta)) / theta2 * W;
523 M2.noalias() = (theta - sin(theta)) / (theta2 * theta) * (W * W);
524 return Eigen::Matrix<T, 3, 3>::Identity() + M1 + M2;
525}
526
544template <typename Derived>
545inline Eigen::Matrix<typename Derived::Scalar, 3, 3> jac_SO3_left_inv(const Eigen::MatrixBase<Derived>& _theta)
546{
547 using std::cos;
548 using std::sin;
549 using std::sqrt;
550
552
553 typedef typename Derived::Scalar T;
554
555 T theta2 = _theta.squaredNorm();
556 Eigen::Matrix<T, 3, 3> W(skew(_theta));
557 if (theta2 <= Constants::EPS_SMALL)
558 return Eigen::Matrix<T, 3, 3>::Identity() + (T)0.5 * W; // Small angle approximation
559 T theta = sqrt(theta2); // rotation angle
560 Eigen::Matrix<T, 3, 3> M;
561 M.noalias() = ((T)1.0 / theta2 - ((T)1.0 + cos(theta)) / ((T)2.0 * theta * sin(theta))) * (W * W);
562 return Eigen::Matrix<T, 3, 3>::Identity() - (T)0.5 * W + M; // is this really more optimized?
563}
564
567template <typename D1, typename D2, typename D3, typename D4, typename D5>
568inline void compose(const Eigen::QuaternionBase<D1>& _q1,
569 const Eigen::QuaternionBase<D2>& _q2,
570 Eigen::QuaternionBase<D3>& _q_comp,
571 Eigen::MatrixBase<D4>& _J_comp_q1,
572 Eigen::MatrixBase<D5>& _J_comp_q2)
573{
576
577 _q_comp = _q1 * _q2;
578
579 _J_comp_q1 = q2R(_q2.conjugate()); // R2.tr
580 _J_comp_q2.setIdentity();
581}
582
585template <typename D1, typename D2, typename D3, typename D4, typename D5>
586inline void between(const Eigen::QuaternionBase<D1>& _q1,
587 const Eigen::QuaternionBase<D2>& _q2,
588 Eigen::QuaternionBase<D3>& _q_between,
589 Eigen::MatrixBase<D4>& _J_between_q1,
590 Eigen::MatrixBase<D5>& _J_between_q2)
591{
592 MatrixSizeCheck<3, 3>::check(_J_between_q1);
593 MatrixSizeCheck<3, 3>::check(_J_between_q2);
594
595 _q_between = _q1.conjugate() * _q2;
596
597 _J_between_q1 = -q2R(_q2.conjugate() * _q1); // - R2.tr * R1
598 _J_between_q2.setIdentity();
599}
600
603template <typename D1, typename D2>
604inline Eigen::Quaternion<typename D1::Scalar> plus_right(const Eigen::QuaternionBase<D1>& q,
605 const Eigen::MatrixBase<D2>& v)
606{
608 return q * exp_q(v);
609}
610
613template <typename D1, typename D2>
614inline Eigen::Matrix<typename D2::Scalar, 3, 1> minus_right(const Eigen::QuaternionBase<D1>& q1,
615 const Eigen::QuaternionBase<D2>& q2)
616{
617 return log_q(q1.conjugate() * q2);
618}
619
622template <typename D1, typename D2>
623inline Eigen::Quaternion<typename D1::Scalar> plus_left(const Eigen::MatrixBase<D2>& v,
624 const Eigen::QuaternionBase<D1>& q)
625{
627 return exp_q(v) * q;
628}
629
632template <typename D1, typename D2>
633inline Eigen::Matrix<typename D2::Scalar, 3, 1> minus_left(const Eigen::QuaternionBase<D1>& q1,
634 const Eigen::QuaternionBase<D2>& q2)
635{
636 return log_q(q2 * q1.conjugate());
637}
638
641template <typename D1, typename D2>
642inline Eigen::Quaternion<typename D1::Scalar> plus(const Eigen::QuaternionBase<D1>& q, const Eigen::MatrixBase<D2>& v)
643{
644 return plus_right(q, v);
645}
646
649template <typename D1, typename D2>
650inline Eigen::Matrix<typename D2::Scalar, 3, 1> minus(const Eigen::QuaternionBase<D1>& q1,
651 const Eigen::QuaternionBase<D2>& q2)
652{
653 return minus_right(q1, q2);
654}
655
658template <typename D1, typename D2>
659inline Eigen::Matrix<typename D2::Scalar, 3, 1> diff(const Eigen::QuaternionBase<D1>& q1,
660 const Eigen::QuaternionBase<D2>& q2)
661{
662 return minus(q1, q2);
663}
664
665} // namespace wolf
const double EPS_SMALL
Definition: wolf.h:76
Jet< double, N > remainder(const Jet< double, N > &_x, long double _y)
Definition: wolf_jet.h:31
Jet< T, N > sin(const Jet< T, N > &f)
Definition: jet.h:641
Jet< T, N > atan2(const Jet< T, N > &g, const Jet< T, N > &f)
Definition: jet.h:1167
Jet< T, N > sqrt(const Jet< T, N > &f)
Definition: jet.h:617
Jet< T, N > cos(const Jet< T, N > &f)
Definition: jet.h:626
Definition: capture_base.h:23
Eigen::Matrix< typename Derived::Scalar, 3, 3 > q2R(const Eigen::QuaternionBase< Derived > &_q)
Quaternion to rotation matrix conversion.
Definition: rotations.h:108
Eigen::Matrix< typename Derived::Scalar, 3, 1 > q2e(const Eigen::MatrixBase< Derived > &_q)
Euler angles (roll, pitch, yaw) of a quaternion given as a 4-vector [x, y, z, w].
Definition: rotations.h:186
Eigen::Matrix< typename D2::Scalar, 3, 1 > minus(const Eigen::QuaternionBase< D1 > &q1, const Eigen::QuaternionBase< D2 > &q2)
Minus (right minus): log_q(q1.conj * q2)
Definition: rotations.h:650
Eigen::Quaternion< typename Derived::Scalar > v2q(const Eigen::MatrixBase< Derived > &_v)
Rotation vector to quaternion conversion.
Definition: rotations.h:376
Eigen::Matrix< typename Derived::Scalar, 3, 3 > jac_SO3_right_inv(const Eigen::MatrixBase< Derived > &_theta)
Computes Jrinv (inverse of Right Jacobian which corresponds to the jacobian of log) Right Jacobian fo...
Definition: rotations.h:472
T pi2pi(const T &_angle)
Returns the angle wrapped to [-pi, pi].
Definition: rotations.h:33
Eigen::Matrix< typename Derived::Scalar, 3, 1 > R2e(const Eigen::MatrixBase< Derived > &_R)
Euler angles (roll, pitch, yaw) of a rotation matrix.
Definition: rotations.h:172
Eigen::Quaternion< typename Derived::Scalar > exp_q(const Eigen::MatrixBase< Derived > &_v)
Quaternion exponential map.
Definition: rotations.h:267
Eigen::Matrix< typename Derived::Scalar, 3, 3 > jac_SO3_left(const Eigen::MatrixBase< Derived > &_theta)
Computes Jl (Left Jacobian) Left Jacobian for exp map in SO(3) - equation (10.86) and following equat...
Definition: rotations.h:506
Eigen::Matrix< typename D2::Scalar, 3, 1 > minus_left(const Eigen::QuaternionBase< D1 > &q1, const Eigen::QuaternionBase< D2 > &q2)
Left minus: log_q(q2 * q1.conj)
Definition: rotations.h:633
Eigen::Matrix< typename D2::Scalar, 3, 1 > diff(const Eigen::QuaternionBase< D1 > &q1, const Eigen::QuaternionBase< D2 > &q2)
Difference (right minus): log_q(q1.conj * q2)
Definition: rotations.h:659
T toDeg(const T rad)
Conversion to degrees.
Definition: rotations.h:55
Eigen::Quaternion< typename D1::Scalar > plus_right(const Eigen::QuaternionBase< D1 > &q, const Eigen::MatrixBase< D2 > &v)
Right plus: q * exp_q(v)
Definition: rotations.h:604
Eigen::Matrix< typename Derived::Scalar, 3, 3 > v2R(const Eigen::MatrixBase< Derived > &_v)
Rotation vector to rotation matrix conversion.
Definition: rotations.h:398
Eigen::Matrix< typename Derived::Scalar, 3, 1 > q2v(const Eigen::QuaternionBase< Derived > &_q)
Quaternion to rotation vector conversion.
Definition: rotations.h:387
Eigen::Matrix< typename Derived::Scalar, 3, 3 > jac_SO3_right(const Eigen::MatrixBase< Derived > &_theta)
Computes Jr (Right Jacobian) Right Jacobian for exp map in SO(3) - equation (10.86) and following equ...
Definition: rotations.h:432
Eigen::Matrix< typename Derived::Scalar, 3, 3 > exp_R(const Eigen::MatrixBase< Derived > &_v)
Rotation matrix exponential map.
Definition: rotations.h:342
Eigen::Matrix< typename D2::Scalar, 3, 1 > minus_right(const Eigen::QuaternionBase< D1 > &q1, const Eigen::QuaternionBase< D2 > &q2)
Right minus: log_q(q1.conj * q2)
Definition: rotations.h:614
Eigen::Matrix< typename Derived::Scalar, 3, 1 > log_q(const Eigen::QuaternionBase< Derived > &_q)
Quaternion logarithmic map.
Definition: rotations.h:296
Eigen::Quaternion< typename D::Scalar > e2q(const Eigen::MatrixBase< D > &_euler)
Euler angles to quaternion.
Definition: rotations.h:144
T toRad(const T deg)
Conversion to radians.
Definition: rotations.h:44
Eigen::Matrix< typename Derived::Scalar, 3, 1 > R2v(const Eigen::MatrixBase< Derived > &_R)
Rotation matrix to rotation vector conversion.
Definition: rotations.h:409
Eigen::Matrix< typename Derived::Scalar, 3, 1 > log_R(const Eigen::MatrixBase< Derived > &_R)
Rotation matrix logarithmic map.
Definition: rotations.h:365
Eigen::Quaternion< typename Derived::Scalar > R2q(const Eigen::MatrixBase< Derived > &_R)
Rotation matrix to quaternion conversion.
Definition: rotations.h:132
Eigen::Quaternion< typename D1::Scalar > plus_left(const Eigen::MatrixBase< D2 > &v, const Eigen::QuaternionBase< D1 > &q)
Left plus: exp_q(v) * q.
Definition: rotations.h:623
Eigen::Matrix< typename Derived::Scalar, 3, 3 > jac_SO3_left_inv(const Eigen::MatrixBase< Derived > &_theta)
Computes Jl_inv (inverse of Left Jacobian which corresponds to the jacobian of log) Left Jacobian for...
Definition: rotations.h:545
Eigen::Quaternion< typename D1::Scalar > plus(const Eigen::QuaternionBase< D1 > &q, const Eigen::MatrixBase< D2 > &v)
Plus (right plus): q * exp_q(v)
Definition: rotations.h:642
Eigen::Matrix< typename Derived::Scalar, 3, 1 > vee(const Eigen::MatrixBase< Derived > &_m)
Inverse of skew symmetric matrix.
Definition: rotations.h:88
Eigen::Matrix< typename Derived::Scalar, 3, 3 > e2R(const Eigen::MatrixBase< Derived > &_e)
Euler angles to rotation matrix.
Definition: rotations.h:162
void between(const Eigen::QuaternionBase< D1 > &_q1, const Eigen::QuaternionBase< D2 > &_q2, Eigen::QuaternionBase< D3 > &_q_between, Eigen::MatrixBase< D4 > &_J_between_q1, Eigen::MatrixBase< D5 > &_J_between_q2)
Quaternion between two quaternions q1.conj * q2, with the Jacobians wrt local (right) perturbations.
Definition: rotations.h:586
Eigen::Matrix< typename Derived::Scalar, 3, 3 > skew(const Eigen::MatrixBase< Derived > &_v)
Skew symmetric matrix.
Definition: rotations.h:69
Eigen::MatrixBase< Derived >::Scalar getYaw(const Eigen::MatrixBase< Derived > &_M)
Yaw angle of a rotation matrix or of a quaternion given as a 4-vector [x, y, z, w].
Definition: rotations.h:230
void compose(const Eigen::QuaternionBase< D1 > &_q1, const Eigen::QuaternionBase< D2 > &_q2, Eigen::QuaternionBase< D3 > &_q_comp, Eigen::MatrixBase< D4 > &_J_comp_q1, Eigen::MatrixBase< D5 > &_J_comp_q2)
Composition of two quaternions q1 * q2, with the Jacobians wrt local (right) perturbations.
Definition: rotations.h:568
static void check(const T &t)
Asserts the matrix size dynamically or statically.
Definition: wolf.h:194
#define M_TORAD
Definition: wolf.h:68
#define M_TODEG
Definition: wolf.h:69